package com.mes.web.controller.hpf;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mes.entity.yzl.Condition;
import com.mes.entity.yzl.CustomerOrder;
import com.mes.entity.yzl.ListBack;
import com.mes.entity.zc.CustomerDetails;
import com.mes.service.hpf.CustomerDetailsService;
import com.mes.web.controller.yzl.Sup;

@Controller
@RequestMapping("/hpf")
public class CustomerDetailsController {

    @Resource
    public CustomerDetailsService customerDetailsService;
    
    /***
     * 分页查询所有用户
     * @return
     */
    @RequestMapping("/customerPageList")
    public @ResponseBody ListBack customerPageList(Condition condition){

    	ListBack listBack = new ListBack();

        //查询条件处理
        Sup sup = new Sup();
        condition = sup.tdSet(condition);
        int count = customerDetailsService.customerCount();
        listBack.setTotal(count);
        List<CustomerDetails> customerDetails = new ArrayList<>();
        customerDetails = customerDetailsService.customerPageList(condition);
        listBack.setRows(customerDetails);
        return listBack;

    }
    
    /***
     * 查询所有用户
     * @return
     */
    @RequestMapping("/customerAllList")
    public @ResponseBody List<CustomerDetails> customerAllList(){
    	
    	List<CustomerDetails> customerDetails =customerDetailsService.customerAllList();
    	
    	return customerDetails;
    	
    }
    
}
